package cn.fufeiii.bt.nomiddleware.openfeign;

import cn.fufeiii.bt.nomiddleware.openfeign.api.StudentApi;
import cn.fufeiii.bt.nomiddleware.openfeign.dto.AddRequest;
import cn.fufeiii.bt.nomiddleware.openfeign.dto.GetListRequest;
import cn.fufeiii.bt.nomiddleware.openfeign.dto.GetListResponse;
import cn.fufeiii.bt.nomiddleware.openfeign.dto.GetResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

import static cn.fufeiii.bt.nomiddleware.openfeign.StudentApiFeignClientController.BASE_PATH;

/**
 * @author FuFei
 */
@FeignClient(name = "StudentApiFeignClient", url = "localhost:${client.port:${server.port}}")
public interface StudentApiFeignClient extends StudentApi {

    @PostMapping(value = BASE_PATH + PATH_ADD)
    @Override
    void add(@RequestBody AddRequest addRequest);

    @GetMapping(value = BASE_PATH + PATH_GET)
    @Override
    GetResponse get(@PathVariable("id") Long id);

    @PostMapping(value = BASE_PATH + PATH_GET_LIST)
    @Override
    List<GetListResponse> getList(@RequestBody GetListRequest request);

}
